Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mastodon
GitHub Repository: mastodon/joinmastodon
Path: blob/main/pages/about/[slug].tsx
1006 views
1
import { useRouter } from "next/router"
2
import Image from "next/legacy/image"
3
import bios from "../../data/bio"
4
import board from "../../data/board"
5
import { withDefaultStaticProps } from "../../utils/defaultStaticProps"
6
import {
7
mapMastodonUrlToHandle,
8
mapBoardPositionToLabel,
9
} from "../../utils/map"
10
import Layout from "../../components/Layout"
11
import LogoWhite from "../../public/logos/logo-white.svg?inline"
12
13
const missingAvatarSrc = require("../../public/avatars/missing_avatar.png")
14
15
const AboutMember = () => {
16
const router = useRouter()
17
const member = board.find((member) => member.slug === router.query.slug)
18
const avatarSrc = member.avatar || missingAvatarSrc
19
const boardPositionLabel = mapBoardPositionToLabel(member.position)
20
21
return (
22
<Layout transparentHeader={false}>
23
<div dir="ltr" className="[unicode-bidi:plaintext]"></div>
24
<div className="full-width-bg">
25
<div className="mx-auto w-full max-w-site px-6 sm:px-20 lg:px-32 xl:px-52">
26
<div className="md:grid md:grid-cols-12 md:gap-y-24 pt-40 pb-10 md:gap-x-12 border-b border-gray-3 ">
27
<div className="md:col-span-7 md:col-start-6">
28
<span className="h3">{member.name}</span>
29
</div>
30
</div>
31
<div className="md:grid md:grid-cols-12 md:gap-y-24 pt-10 pb-60 md:gap-x-12">
32
<div className="md:col-span-5 mb-10">
33
<div className="flex flex-col text-center items-center">
34
<div className="mb-4">
35
<Image
36
src={avatarSrc}
37
width="170"
38
height="170"
39
alt=""
40
className="rounded-full"
41
/>
42
</div>
43
{member.otherTitle && (
44
<div className="b2 mt-2">{member.otherTitle}</div>
45
)}
46
<div className="b2 mt-2">
47
{member.title
48
? `${boardPositionLabel}, ${member.title}`
49
: boardPositionLabel}
50
</div>
51
{member.socials && (
52
<div className="flex flex-row items-center mt-2">
53
<LogoWhite
54
className="h-[1em] w-[1em] text-blurple-600 -mb-1"
55
fill="currentColor"
56
/>
57
<a
58
href={member.socials.mastodon}
59
rel="me"
60
className="b2 ml-2 block flex-shrink-0 text-blurple-600 hocus:underline"
61
>
62
{mapMastodonUrlToHandle(member.socials.mastodon)}
63
</a>
64
</div>
65
)}
66
</div>
67
</div>
68
<div className="md:col-span-7 lg:col-span-6 md:col-start-6">
69
<p className="b2">{bios[member.slug]}</p>
70
</div>
71
</div>
72
</div>
73
</div>
74
</Layout>
75
)
76
}
77
78
export async function getStaticPaths() {
79
const paths = board
80
.filter((member) => member.slug)
81
.map((member) => ({
82
params: { slug: member.slug },
83
}))
84
85
return { paths, fallback: false }
86
}
87
88
export const getStaticProps = withDefaultStaticProps()
89
90
export default AboutMember
91
92